/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 言初
 * Date: 2023-01-10
 * Time: 11:00
 */
public class Test {
    public static void main(String[] args) {
        MyArraylist myArraylist=new MyArraylist();
        myArraylist.display();//打印
        myArraylist.add(1);//新增
        myArraylist.add(4);//新增

        myArraylist.display();//打印

        myArraylist.add(1, 2);//新增
        myArraylist.display();//打印

        myArraylist.set(2,3);//更新某个位置的值
        myArraylist.display();//打印

        myArraylist.remove(2);//删除第一个出现的key值
        myArraylist.display();//打印



        System.out.println(myArraylist.contains(3));//判断是否包含某个元素
        System.out.println(myArraylist.indexOf(1));//查找某个元素对应的位置
        System.out.println(myArraylist.get(1));//获得这个位置对应的元素
        System.out.println(myArraylist.size());//顺序表的长度
        myArraylist.clear();//清空顺序表
        myArraylist.display();//打印
    }
}



